package com.bh.extend.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.extend.domain.JcVehicleHeadFixRecord;
import com.bh.extend.mapper.JcVehicleHeadFixRecordMapper;
import com.bh.extend.service.IJcVehicleHeadFixRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 车辆维修记录Service业务层处理
 *
 * @author slx
 * @date 2023-03-26
 */
@Service
public class JcVehicleHeadFixRecordServiceImpl extends ServiceImpl<JcVehicleHeadFixRecordMapper, JcVehicleHeadFixRecord> implements IJcVehicleHeadFixRecordService {
    @Autowired
    private JcVehicleHeadFixRecordMapper jcVehicleHeadFixRecordMapper;

    /**
     * 查询车辆维修记录
     *
     * @param id 车辆维修记录主键
     * @return 车辆维修记录
     */
    @Override
    public JcVehicleHeadFixRecord selectJcVehicleHeadFixRecordById(Long id) {
        return jcVehicleHeadFixRecordMapper.selectById(id);
    }

    /**
     * 查询车辆维修记录列表
     *
     * @param jcVehicleHeadFixRecord 车辆维修记录
     * @return 车辆维修记录
     */
    @Override
    public List<JcVehicleHeadFixRecord> selectJcVehicleHeadFixRecordList(JcVehicleHeadFixRecord jcVehicleHeadFixRecord) {
        return jcVehicleHeadFixRecordMapper.selectJcVehicleHeadFixRecordList(jcVehicleHeadFixRecord);
    }

    /**
     * 新增车辆维修记录
     *
     * @param jcVehicleHeadFixRecord 车辆维修记录
     * @return 结果
     */
    @Override
    public int insertJcVehicleHeadFixRecord(JcVehicleHeadFixRecord jcVehicleHeadFixRecord) {
        jcVehicleHeadFixRecord.setCreateTime(DateUtils.getNowDate());
        return jcVehicleHeadFixRecordMapper.insert(jcVehicleHeadFixRecord);
    }

    /**
     * 修改车辆维修记录
     *
     * @param jcVehicleHeadFixRecord 车辆维修记录
     * @return 结果
     */
    @Override
    public int updateJcVehicleHeadFixRecord(JcVehicleHeadFixRecord jcVehicleHeadFixRecord) {
        jcVehicleHeadFixRecord.setUpdateTime(DateUtils.getNowDate());
        return jcVehicleHeadFixRecordMapper.updateById(jcVehicleHeadFixRecord);
    }

    /**
     * 批量删除车辆维修记录
     *
     * @param ids 需要删除的车辆维修记录主键
     * @return 结果
     */
    @Override
    public int deleteJcVehicleHeadFixRecordByIds(Long[] ids) {
        return jcVehicleHeadFixRecordMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除车辆维修记录信息
     *
     * @param id 车辆维修记录主键
     * @return 结果
     */
    @Override
    public int deleteJcVehicleHeadFixRecordById(Long id) {
        return jcVehicleHeadFixRecordMapper.deleteById(id);
    }
}
